<?php  include VIEWPATH.'common/head.php';  ?>
    <script type="text/javascript">
        var status = '<?php echo $_GET['status'];?>';
        if(status == '-1'){
            alert('fail:<?php echo $_GET['msg'];?>');
        }
        /**
         * 批量删除
         */
        function setDelList(){
            var ids = document.getElementsByName('label_id[]');
            var sel_ids = '';
            for (var i = 0; i < ids.length; i++){
                if (ids[i].checked) {
                    sel_ids += ids[i].value + ',';
                }
            }
            if(sel_ids == ''){
                alert('请选择要删除的用户');
                return;
            }
            sel_ids = sel_ids.substr(0,sel_ids.length - 1);
            if(sel_ids == ''){
                alert('请选择要删除的项');
                return ;
            }
            del_label(sel_ids);
        }
        function del_label(id){
            if(confirm("确定删除吗？")){
                $.ajax({
                    type:'get',
                    url:'index.php?c=label&m=label_del&id='+id,
                    data:{},
                    cache:false,
                    dataType:'json',
                    success:function(data){
                        if(data.errorCode == 0) {
                            //表单提交
                            window.location.href = window.location.href;
                            return;
                        }else{
                            alert(data.errorMsg);
                        }
                    },
                    error:function(data){
                        alert(data);
                    }
                });
            }
        }
    </script>
    <style>
        .form-group{margin-left:0px !important;margin-right:0px !important; margin-bottom:10px;}
    </style>
    <body class="gray-bg">
    <div class="wrapper wrapper-content ">
        <div class="add-btn" style="float:right;margin-bottom:5px;">
            <div class="modal fade" id="edit_goods" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                <div class="modal-dialog" style="width: 60%;"><div class="modal-content"></div></div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="table-responsive">

                            <form class="form-horizontal" id="f_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" name="form" method="post">

                                <div class="form-group">
                                    <div class="col-sm-1">
                                        <label class="control-label">奖励商品名称：</label>
                                    </div>
                                    <div class="col-sm-3">
                                        <input type="text" name="like" value="<?php echo $_REQUEST['like'];?>" class="form-control input-search" placeholder="Search...">
                                    </div>
                                    <button class="btn btn-primary" type="submit"> 搜索 </button>
<!--                                    <a class="btn btn-danger" href="index.php?c=task&m=edit_goods" data-toggle="modal" data-target="#edit_goods" style="float: right;">添加奖励</a>-->
                                </div>
                                <table class="table table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th>序号</th>
                                            <th>奖品名</th>
                                            <th>商品图片地址</th>
                                            <th>商品url</th>
                                            <th>收货信息</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        $i=0;
                                        foreach($list as $label){
                                            $i++;
                                        ?>
                                            <tr>
                                                <th scope="row">
                                                    <?php echo $i;?>
                                                </th>
                                                <td><?php echo $label["name"];?></td>
                                                <td><img src="http://imger.jinsque.com/<?php echo $label["img"];?>" width="100px" height="100px">
                                                </td>
                                                <td>
                                                    <a target="_blank" href="<?php echo $label["url"];?>">
                                                        <?php echo $label["url"];?>
                                                    </a>
                                                </td>
                                                <td><?php echo '姓名：'.$label["a_name"].'  手机号：'.$label["a_mobile"].'  地址：'.$label["a_address"];?></td>
                                                <td><?php echo $label["status"]==0?'平台已领奖未填收货信息':$label["status"]==1?'有收货信息可下单':'淘宝下单已完成';?></td>


                                                <td  nowrap="nowrap">
                                                    <a href="index.php?c=task&m=edit_goods&id=<?php echo $label["utp_id"];?>" data-toggle="modal" data-target="#edit_goods" class="btn btn-white btn-sm"><i class="fa fa-pencil"></i> 编辑</a>
                                                    <a href="index.php?c=user&m=user_info&uid=<?php echo $label["uid"];?>"   target="_blank" class="btn btn-white btn-sm"> 查看用户信息</a>

                                                </td>
                                            </tr>
                                        <?php } ?>
                                    </tbody>
                                </table>
                                <div class="set_page">
                                    <?php echo $multipage; ?>

                                    <div class="clearfix"></div>
                                </div>
                            </form>

                        </div>
                    </div>
                </div>
            </div>

        </div>

    </div>
<?php  include VIEWPATH.'common/footer.php';  ?>